package com.sinopec.user;

import java.io.File;
import jxl.Workbook;

public class UserList {
	public static int startRow = 1;
	public static int userName = 0;
	public static int userGroup = 1;
	
	public static String[][] get(String path){
		try {
			File f = new File(path);
			Workbook workbook = Workbook.getWorkbook(f); 
			jxl.Sheet sheet =  workbook.getSheet(0);
			
			//get excel cell all start from 0
			int rowNum = sheet.getRows()-1;
			String[][] user = new String[rowNum][2];
			for (int i = startRow; i < sheet.getRows(); ++i) {
				user[i-startRow][userName] = sheet.getCell(userName, i).getContents();
				user[i-startRow][userGroup] = sheet.getCell(userGroup, i).getContents();
			}
			return user;
		}
		catch(Exception e){
			System.err.println("error on geting excel!");
			return null;
		}
		
	}
	public static void main(String[] args){
		get("C:\\/1.xls");
	}
}
